package com.example.springboot4.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class VersionedApiController {

    // Version 1 of the API
    @RequestMapping(value = "/api/user", version = "1")
    public String getUserV1() {
        return "User info from API v1";
    }

    // Version 2 of the API
    @RequestMapping(value = "/api/user", version = "2")
    public String getUserV2() {
        return "User info from API v2 with enhanced data";
    }

    // Without versioning for comparison
    @GetMapping("/api/user")
    public String getUser() {
        return "User info from default API";
    }
}